import {clsFile, getEditLog, getFileList,} from '@/api/file/'

const state = {
  fileList: {},
}

const mutations = {
  SET_ATTENDANCELIST: (state, data) => {
    state.fileList = data
  }
}

const actions = {
  // 获取文档列表
  getFileListAct({ commit }, params) {
    return new Promise((resolve, reject) => {
      getFileList(params).then(response => {
        const { data } = response
        resolve(data)
      }).catch(error => {
        reject(error)
      })
    })
  },
  // 查看编辑历史
  getEditLogAct({ commit }, params) {
    return new Promise((resolve, reject) => {
      getEditLog(params).then(response => {
        const { data } = response
        resolve(data)
      }).catch(error => {
        reject(error)
      })
    })
  },
  // 文档封禁
  clsFileAct({ commit }, params) {
    return new Promise((resolve, reject) => {
      clsFile(params).then(response => {
        const { data } = response
        resolve(data)
      }).catch(error => {
        reject(error)
      })
    })
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

